package cn.tedu.hotelApi.dictOption.controller;

import cn.tedu.hotelApi.base.response.JsonResult;
import cn.tedu.hotelApi.dictOption.pojo.dto.DictOptionParam;
import cn.tedu.hotelApi.dictOption.pojo.dto.DictOptionQuery;
import cn.tedu.hotelApi.dictOption.pojo.vo.DictOptionVO;
import cn.tedu.hotelApi.dictOption.service.DictOptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/v1/dictoption")
public class DictOptionController {
    @Autowired
    private DictOptionService dictOptionService;
    @GetMapping("select")
    public JsonResult selectDictOption(DictOptionQuery dictOptionQuery){
        List<DictOptionVO> dictOptionVOList = dictOptionService.selectDictOption(dictOptionQuery);
        return JsonResult.ok(dictOptionVOList);
    }
    @PostMapping("save")
    public JsonResult saveDictOption(DictOptionParam dictOptionParam){
        dictOptionService.saveDictOption(dictOptionParam);
        return JsonResult.ok();
    }
    @PostMapping("delete/{id}")
    public JsonResult delete(@PathVariable Long id){
        dictOptionService.deleteDictOption(id);
        return JsonResult.ok();
    }
}
